package com.yedean;

import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentSkipListMap;

/**
 * BeanFactory
 *
 * @author yedean
 * @date 2022/6/27
 */
public class BeanFactory {
    
    private final  Map<String,BeanDefinition> beanDefinitionMap =new ConcurrentHashMap<>();
    
    public Object getBean(String beanName){
        BeanDefinition definition = beanDefinitionMap.get(beanName);
        return definition.getBean();
    }
    
    public void registryBean(String beanName,BeanDefinition definition){
        beanDefinitionMap.put(beanName,definition);
    }
}
